#pragma once
#include "types.h"
#include "Manager.h"
#include "Z80_CPU.h"

	class Z80_CPU
	{
	public:
		Z80_CPU(void);
		~Z80_CPU(void);
		int test(int b1, int b0);
		void reset();
		void main_loop();
		bool interpret();
		void run_cpu();
	private:
		typedef union {
		  struct {
			u8 B1, B0;
		  } B;
		  short W;
		} BoyRegister;
		// Cpu Shit :P
		int PC;
		BoyRegister tmp_register;
		// Index Registers
		short ix,iy;
		// Other Registers
		u8 i,r;
		// Flag Registers
                static const int C_FLAG = 0x10;
                static const int H_FLAG = 0x20;
                static const int N_FLAG = 0x40;
                static const int Z_FLAGS = 0x80;
		// Registers
		BoyRegister BC,HL,DE,AF,SP;
		// Immediate Operands
		u8 n;
		short nn;
		// Manager
		Manager *man;
	};
